#include "swap.c"
#include "array_and_file.c"
#pragma once

void insertion_sort (int *array, int file_size, char *unsorted_input_file, char *sorted_output_file)
{
    int i, j;

	read_file_into_array (array, file_size, unsorted_input_file);
    for (i = 1; i < file_size; i++) {
        for (j = i; j >= 1; j--) {
            if (array[j] >= array[j-1]) break;
            swap(&array[j], &array[j-1]);
        }
    }

	write_array_to_file (array, file_size, sorted_output_file);
}
